import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import ConfigElementType 1.0
import "qrc:/qmlComponents/ConfigManager"

Item {
    RowLayout{
        GroupBox{
            Layout.alignment: Qt.AlignTop

            title: qsTr("PickPlace")
            ColumnLayout{
                spacing: -2

                ConfigRow{
                    configModel: pickPlaceConfig
                    configName: "softlandingPickVel"
                    Component.onCompleted: {
                        autoInit()
                    }
                }
                ConfigRow{
                    configModel: pickPlaceConfig
                    configName: "softlandingPickForce"
                    Component.onCompleted: {
                        autoInit()
                    }
                }
                ConfigRow{
                    configModel: pickPlaceConfig
                    configName: "useFastSoftlandingPick"
                    Component.onCompleted: {
                        autoInit()
                    }
                }
                ConfigRow{
                    configModel: pickPlaceConfig
                    configName: "openVacuumDelayAfterStartSoftlanding"
                    Component.onCompleted: {
                        autoInit()
                    }
                }

                ConfigRow{
                    configModel: pickPlaceConfig
                    configName: "softlandingPlaceVel"
                    Component.onCompleted: {
                        autoInit()
                    }
                }
                ConfigRow{
                    configModel: pickPlaceConfig
                    configName: "softlandingPlaceForce"
                    Component.onCompleted: {
                        init(ConfigElementType.Double)
                    }
                }
                ConfigRow{
                    configModel: pickPlaceConfig
                    configName: "useFastSoftlandingPlace"
                    Component.onCompleted: {
                        autoInit()
                    }
                }
                ConfigRow{
                    configModel: pickPlaceConfig
                    configName: "delayBeforePick"
                    Component.onCompleted: {
                        autoInit()
                    }
                }
                ConfigRow{
                    configModel: pickPlaceConfig
                    configName: "delayBeforePlace"
                    Component.onCompleted: {
                        autoInit()
                    }
                }
                ConfigRow{
                    configModel: pickPlaceConfig
                    configName: "delayAfterSoftLandUpCmd"
                    Component.onCompleted: {
                        init(ConfigElementType.Int)
                    }
                }
                ConfigRow{
                    configModel: pickPlaceConfig
                    configName: "delayAfterSoftlandContact"
                    Component.onCompleted: {
                        autoInit()
                    }
                }
                ConfigRow{
                    configModel: pickPlaceConfig
                    configName: "delayAfterOpenVacuum"
                    Component.onCompleted: {
                        autoInit()
                    }
                }
                ConfigRow{
                    configModel: pickPlaceConfig
                    configName: "delayAfterCloseVacuum"
                    Component.onCompleted: {
                        autoInit()
                    }
                }
            }
        }

        ColumnLayout{
            Layout.alignment: Qt.AlignTop

            GroupBox{
                title: qsTr("Calibration")

                ColumnLayout{
                    ConfigRow{
                        configModel: bhConfig
                        configName: "useCorFromCalibration"
                        Component.onCompleted: {
                            autoInit()
                        }
                    }
                    ConfigRow{
                        configModel: bhConfig
                        configName: "useStSideTwoDimCaliData"
                        Component.onCompleted: {
                            autoInit()
                        }
                    }
                    ConfigRow{
                        configModel: bhConfig
                        configName: "useLtSideTwoDimCaliData"
                        Component.onCompleted: {
                            autoInit()
                        }
                    }
                }
            }

            GroupBox{
                title: qsTr("HigherAcc")

                ColumnLayout{
                    ConfigRow{
                        configModel: bhConfig
                        configName: "higherBHYAccRatio"
                        Component.onCompleted: {
                            autoInit()
                        }
                    }
                    ConfigRow{
                        configModel: bhConfig
                        configName: "higherBHZAccRatio"
                        Component.onCompleted: {
                            autoInit()
                        }
                    }
                    Button{
                        text: qsTr("ResetBHYZAcc")
                        onClicked: {
                            tem.runSingleCmd(bonderHead, "resetBHYZAcc")
                        }
                    }
                }
            }

            GroupBox{
                title: qsTr("UplookPr")

                ColumnLayout{
                    ConfigRow{
                        configModel: bhConfig
                        configName: "delayAfterGiveUplookPrCmd"
                        Component.onCompleted: {
                            autoInit()
                        }
                    }
                    ConfigRow{
                        configModel: bhConfig
                        configName: "alignCircularLensToSensor"
                        Component.onCompleted: {
                            autoInit()
                        }
                    }
                }
            }
        }

        GroupBox{
            Layout.alignment: Qt.AlignTop

            title: qsTr("PostBond(um)")
            ColumnLayout{
                ConfigRow{
                    configModel: bwhConfig
                    configName: "postBondOffsetCorrectionX"
                    Component.onCompleted: {
                        autoInit()
                    }
                }
                ConfigRow{
                    configModel: bwhConfig
                    configName: "postBondOffsetCorrectionY"
                    Component.onCompleted: {
                        autoInit()
                    }
                }
                ConfigRow{
                    configModel: bwhConfig
                    configName: "postBondLimitX"
                    Component.onCompleted: {
                        autoInit()
                    }
                }
                ConfigRow{
                    configModel: bwhConfig
                    configName: "postBondLimitY"
                    Component.onCompleted: {
                        autoInit()
                    }
                }
            }
        }
    }
}
